<script type="text/javascript" src="/admins/js/jquery/jquery.PrintArea.js"></script>
<!--startprint-->
<div id="billboy">
    <div id='userdetail'>
        <style>
            body{
                 -webkit-print-color-adjust: exact;
            }
            #billboy{
                font-size: 8px;
                width: 75%;

            }
            #userdetail{
                line-height: 36px;
                padding-left: 20px;
                padding-bottom: 10px;
                line-height: 12px;
            }
            #billdetail{
                padding-left: 20px;
                padding-bottom: 10px;
                padding-top:10px;
            }
            #billboy table td{
                border: 1px solid #CCCCCC;
            }
            #packdetail table td{
                border: 1px solid #CCCCCC;
            }
            #bf{
                background-color: #ddd;
                text-align: right;
                width: 120px;
                line-height: 30px;
                font-size: 8px;
            }
            #cf{
                font-size: 12px;
            }
            #gf{
                text-align: center;
                background-color: #ddd;
                height: 36px;
            }
            #hf{
                text-align: center;
                font-size:8px;
            }
        </style>
        <div style="line-height: 30px;">物流信息</div>
        <table width="90%" border="1" cellpadding="0" cellspacing="0">
            <tr>
              <td id='bf' height="36px">仓库号：</td>
              <td id='cf'>&nbsp;&nbsp;<?php echo $this->billall->user->storeno;?><p>&nbsp;&nbsp;(ID:<?php echo $this->billall->user->id;?>&nbsp;呢称:<?php echo $this->billall->user->nikename;?>)</td>
              <td id='bf'>国家：</td><td id='cf'>&nbsp;&nbsp;<?php echo $this->billall->UserCity->name.'('.$this->billall->UserCity->ename.')';?></td>
            </tr>
            <tr>
              <td id='bf'>悠奇运单编号：</td>
              <td id='cf'>&nbsp;&nbsp;<?php echo $this->billall->billNo;?></td>
              <td id='bf'>运单提交时间：</td>
              <td id='cf'>&nbsp;&nbsp;<?php echo $this->billall->dateCreated;?></td>
            </tr>
            <tr>
              <td id='bf'>运送方式：</td><td id='cf'>&nbsp;&nbsp;<?php echo $this->billall->ExpressBy->name; ?></td>
              <td id='bf'>是否去吊牌：</td><td id='cf'>&nbsp;&nbsp;<?php if($this->billall->isNoLogo==1){echo "是";}else{echo "否";}?></td>
            </tr>
            <tr>
              <td id='bf'>是否去包装：</td><td id='cf'>&nbsp;&nbsp;<?php if($this->billall->isNoSkin==1){echo "是";}else{echo "否";}?></td>
              <td id='bf'>是否真空包装：</td><td id='cf'>&nbsp;&nbsp;<?php echo $this->billall->IsCompress?'要真空(费用:+'. $this->billall->getFeeByType(Application_Model_FeeType::VacuumSeviceFee) .'元)':'否' ?></td>
            </tr>
            <tr>
                <td id='bf'>是否木架加固：</td><td id='cf'>&nbsp;&nbsp;<?= $this->billall->isWooden?'要木架加固(费用:+'. $this->billall->getFeeByType(Application_Model_FeeType::WoodenFee) .'元)':'否' ?></td>
                <td id='bf'>易碎物品是否防震：</td><td id='cf'>&nbsp;&nbsp;<?= ($this->billall->getFeeByType(Application_Model_FeeType::FragileFee) > 0)?"要防震（费用:+".$this->billall->getFeeByType(Application_Model_FeeType::FragileFee)."元)":"否" ?></td>
            </tr>
            <tr>
                <td id='bf' >所属仓位：</td><td id='cf' colspan="3"><span style="font-size:24px;font-weight: 900;">&nbsp;&nbsp;<?php echo $this->billall->locationName;?></span></td>
            </tr>
            <tr>
              <td id='bf'>预付重量：</td><td id='cf'>&nbsp;&nbsp;
                <?php 
                    $volumeWeight = $this->billall->getWeightByType(Application_Model_WeightType::EstimateVolume);
                    $productWeight = $this->billall->getWeightByType(Application_Model_WeightType::ProductWeight);
                    $bagWeight = $this->billall->getWeightByType(Application_Model_WeightType::BagWeight);
                    if ($this->billall->ExpressBy->isVolume == 1) {
                        echo ($volumeWeight > ($productWeight + $bagWeight))?($volumeWeight / 1000)."kg(按预估包裹体积)":(($productWeight + $bagWeight)  / 1000)."kg(按预估包裹重量)";
                    } else {
                        echo (($productWeight + $bagWeight)  / 1000)."kg(按预估包裹重量)";
                    }
                ?>
              <td id='bf'>预付金额：</td><td id='cf'>&nbsp;&nbsp;￥<?php echo $this->billall->getFeeByType(Application_Model_FeeType::EstimateSum);?></td>
            </tr>
            <tr>
                <td id='bf'>申报价值：</td>
                <td id='cf'>&nbsp;&nbsp;<?= $this->billall->getFeeByType(Application_Model_FeeType::ReprotValue) > 0 ? '$' . $this->billall->getFeeByType(Application_Model_FeeType::ReprotValue) . ' USD' : '未填写' ?></td>
                <td id='bf'>投保价值：</td>
                <td id='cf'>&nbsp;&nbsp;
                    <?php
                    $premiumFee = $this->billall->getFeeByType(Application_Model_FeeType::RatePremiumFee);
                    if ($premiumFee > 0) {
                        echo '￥' . $this->billall->getFeeByType(Application_Model_FeeType::PremiumValue) . '元(保费:' . $premiumFee . '元)';
                    } else {
                        echo '未投保';
                    }
                    ?>
                </td>
            </tr>
            <tr>
              <td id='bf'>收货地址：</td><td colspan="3" id='cf'>&nbsp;&nbsp;<?php echo $this->billall->consignee;?>，<?php echo $this->billall->conTel;?>，<?php echo $this->billall->conAdd;?>，<?php echo $this->billall->conPostCode;?></td>
            </tr>
            <tr>
              <td id='bf'>备注：</td><td colspan="3" id='cf'>&nbsp;&nbsp;<?php echo $this->billall->remark;?></td>
            </tr>
            <tr>
                <td id='bf'>悠奇后台备注：</td><td colspan="3" id='cf' style="padding:8px;">
                    <?php if($this->billall->interiorRemark): ?>
                  <p><?php echo $this->billall->interiorRemark;?></p>
                  <?php endif; ?>
                  <?php if($this->remarkObject): ?>
                        
                        <?php foreach($this->remarkObject as $_remark): ?>
                  <p><?php echo $_remark->operator ?>在 <?php echo $_remark->createdAt ?> 留言：<?php echo $_remark->content; ?></p>
                         <?php endforeach; ?>
                  <?php endif; ?>
              </td>
            </tr>
            <tr>
              <td id='bf'>用户备注：</td><td colspan="3" id='cf'>&nbsp;&nbsp;<?php echo $this->billall->user->remark;?></td>
            </tr>
            <tr>
              <td id='bf'>运单编号：</td><td colspan="3" id='cf'>&nbsp;&nbsp;
                  <img src="/barcode/barcode.php?codebar=BCGcode39&text=<?php echo $this->billall->billNo;?>" alt="barcode" width="350px" height="42px" style="margin-left:20px"/></td>
            </tr>
          </table>
    </div>
    <br>
    <div style="line-height: 30px;padding-left: 20px;border-bottom: 1px solid black;">运单货物详情(商品数量：<span style="font-size:24px;font-weight: 900;"><?php echo count($this->storedetail); ?></span>)</div>
    <div id="billdetail">
        <table width="90%"  border="1" cellpadding="0" cellspacing="0">
            <tr><td id='gf' width="18%">仓库单号</td><td id='gf'>名称</td><td id='gf' width="8%">属性</td><td id='gf' width="12%">重量(kg)</td><td id='gf' width="8%">体积重量(kg)</td><td id='gf' width="8%">所在仓位</td></tr>
    <?php
        if($this->storedetail != ''){
        foreach ($this->storedetail as $Item) {?>
            <tr>
                <td id='hf'>&nbsp;&nbsp;<?php echo $Item->barcode;?></td>
                <td height="60px" style="font-size: 8px;">&nbsp;&nbsp;
                    <div style="float:left;padding-top: 5px;">
                        &nbsp;&nbsp;<img src="<?php echo $this->cdn;?><?php echo $Item->image;?>" width="50px" height="50px" style="vertical-align:middle;"/></a>
                    </div>
                    <div style="float:left;margin-top: -10px;width: 88%;padding-left: 5px;">
                        <?php echo $Item->productName;?></a>
                    <p>
                    <div style="float:left;width: 88%;padding-left: 5px;">来自：<?php echo $Item->remark;?></div></div>
                </td>
                <td id='hf'>&nbsp;&nbsp;<?php echo $Item->ItemTypeName; ?></td>
                <td id='hf'>&nbsp;&nbsp;<?php echo $Item->weight/1000;?></td>
                <td id='hf'>&nbsp;&nbsp;<?php echo $Item->volumeWeight==0?"(无)":$Item->volumeWeight/1000;?></td>
                <td id='hf'><?php echo $Item->locationNo?$Item->locationNo:"暂无"; ?></td>
            </tr>
    <?php }}?>
        </table>
    </div>
</div>
    <!--endprint--> 
    <div style='padding-top:10px;padding-bottom: 5px;padding-left: 20px;' id="div_button">
        <input type="button" id="refo" naem="refo" value="返回" style="background-color: #1668A4;width: 80px;height: 30px;color: white;font-size: 14px;border-radius:8px;"/>
        <input type="button" id="print" naem="print" value="打印" style="background-color: #FF8312;width: 80px;height: 30px;color: white;font-size: 14px;border-radius:8px;margin-left: 450px;"/>
    </div>

<script type="text/javascript">
    $("#refo").click(function(){
        location.href = "/admini/managewaybill/billaccep/id/<?php echo $this->billall->id;?>"; 
    });
    $('#div_button #print').click(function(){
        $("div#billboy").printArea(); 
    });
</script>